var KuangWuSprite = cc.Sprite.extend({
	jiazhi:0,
	daxiao:0,
	shudu:0,
	zhonglei:0,
	shengshu:0,
	kuangwusprite:null,
	mc_Mouse:null,
	spMouse:null,
	mm_isOver:false,
	
	ctor:function(_jiazhi,_shengshu,_zhonglei,_daxiao){
		kuangwusprite=this;
//		cc.log("ctor=",_jiazhi,_shengshu,_zhonglei,_daxiao);
		this.jiazhi = _jiazhi;
		this.shengshu = _shengshu;
		this.zhonglei = _zhonglei;
		this.daxiao = _daxiao;
		if ((this.zhonglei==5)||(this.zhonglei==6)) {
			this._super();
			this.mm_isOver=false;
			this.spMouse=ccs.load(res.spMouse_json).node;
			this.addChild(this.spMouse);
			this.mc_Mouse=ccs.load(res.spMouse_json).action;
			this.spMouse.runAction(this.mc_Mouse);
			this.mc_Mouse.play("run",true);
			if (this.zhonglei==5) {
				var spZS=new cc.Sprite(res.kuangwu4_png);
				spZS.setScale(0.7, 0.7);
				this.spMouse.addChild(spZS);
				spZS.x=-26;
				spZS.y=-10;
			}
			this.spMouse.setScaleX(-1);
			
		} else {
			this._super(res["kuangwu"+this.zhonglei+"_png"]);
		}
		//this.getTexture().setAliasTexParameters();//平滑
		this.cushihua();

	},
	getZhongLei:function(){
		return this.zhonglei;
	},
	setStatus:function(){
		this.mm_isOver=true;
		if ((this.zhonglei==5)||(this.zhonglei==6)){
			this.mc_Mouse.gotoFrameAndPause(0);
		}
	},
	setJiaZhi:function(values){
		this.jiazhi=values;
	},
	getJiaZhi:function(){
		return this.jiazhi;
	},
	getShengshu:function(){
		cc.log("this.shengshu=",this.shengshu);
		return this.shengshu;
	},
	cushihua:function(){
		if((this.zhonglei==1)||(this.zhonglei==2))
		{
			var daxiao1=Math.sqrt(this.daxiao);
			
			this.setScale(daxiao1, daxiao1);
			this.jiazhi=Math.floor(this.jiazhi*this.daxiao);
			this.shengshu=this.shengshu/this.daxiao;
		}//矿物为金子和石头时可以变更大小和价值
		if(this.zhonglei==3){
			this.jiazhi=Math.floor((50+450*Math.random())/50)*50;
			this.shengshu=1+6*Math.random();
		}//矿物为问题袋时价值和升速随机
		if ((this.zhonglei==5)||(this.zhonglei==6))
		{
			this.shudu = 1+Math.random()*4;
			this.fangxian=1;
			//this.addEventListener(Event.ENTER_FRAME,yidong);
		}
		if(this.zhonglei==7){
			this.jiazhi=0;
			this.shengshu=10;
		}//矿物为炸药时价值为0
	},
	update:function(dt){
		if(this.mm_isOver) return;
		if ((this.zhonglei==5)||(this.zhonglei==6)) {
			this.x +=  this.fangxian*this.shudu;
			if (this.x > 808)
			{
				this.fangxian = -1;
				this.spMouse.setScaleX(1);
			}
			if (this.x < -40)
			{
				this.fangxian = 1;
				this.spMouse.setScaleX(-1);
			}
		}
	}
});